-
Notifications
You must be signed in to change notification settings - Fork 40
feat: merklelization of lists #528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: merklelization of lists #528
Conversation
…mbda_ethereum_consensus into merklelization-of-lists
…mbda_ethereum_consensus into merklelization-of-lists
…mbda_ethereum_consensus into merklelization-of-lists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments (only minor ones about performance and style). Really good work!
interior_count = node_count - leaf_count | ||
leaf_start = interior_count * @bytes_per_chunk | ||
padded_chunks = chunks |> convert_to_next_pow_of_two(leaf_count) | ||
buffer = <<0::size(leaf_start * @bits_per_byte), padded_chunks::bitstring>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave this for the next PR, but using a binary as a buffer in Elixir kills performance, in the same way using a tuple does. Each time you modify a binary, the VM has to copy it whole, so this is bound to be really slow for big enough inputs. (unless you do it the right way: https://stackoverflow.com/questions/46095870/whats-the-best-way-to-build-long-strings-in-elixir)
As a simple solution, using a list or array and then joining its values once at the end should work.
…mbda_ethereum_consensus into merklelization-of-lists
The failing test is not from this PR. @MegaRedHand can you please take a look? |
Please pull the newest commits from main. It should have been fixed by #607 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Closes #482